from lib2to3.pytree import convert
import sys
from func_timeout import func_set_timeout, FunctionTimedOut
import msvcrt
import os

File_name = ''
@func_set_timeout(0.1)
def get_input_file(pre_str=''):
    global File_name
    File_name = pre_str
    while True:
        File_name += msvcrt.getwch()


if __name__ == '__main__':
    print(sys.argv)
    os.system('pause')

    if len(sys.argv) != 2:
        

        print('请拖入需要转换的文件')
        first_chr = msvcrt.getwch()
        try:
            get_input_file(first_chr)
        except FunctionTimedOut:
            convert(File_name.strip('"'))
    else:
        convert(sys.argv[1])
    
    os.system('pause')
    input('请关闭此窗口，重新运行')